package com.itheima.chapter03.config;

import com.itheima.chapter03.web.FirstServlet;

import com.itheima.chapter03.web.MyFilter;
import com.itheima.chapter03.web.MyListener;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;


@Configuration
public class WebConfigure {
    /*@Bean("firstServlet")
    public FirstServlet firstServlet(){
        return  new FirstServlet();
    }
    @Bean
    public MyFilter myFilter(){
        return  new MyFilter();
    }
    @Bean
    public MyListener myListener(){
        return  new MyListener();
    }

    @Bean
    public ServletRegistrationBean fistServlet() {
        return new ServletRegistrationBean(new FirstServlet(), "/first");
    }

    @Bean
    public FilterRegistrationBean myFilter() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new MyFilter());
        filterRegistrationBean.setUrlPatterns(Arrays.asList("/first"));
        return filterRegistrationBean;
    }

    @Bean
    public ServletListenerRegistrationBean myListener() {
        return new ServletListenerRegistrationBean(new MyListener());
    }*/
}
